package com.fenger.controller;


import com.fenger.domain.Topic;
import com.fenger.service.TopicService;
import com.fenger.utils.DataGirdView;
import com.fenger.vo.TopicVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.ResponseBody;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author 方
 * @since 2019-04-29
 */
@Controller
public class TopicController {
    private final String INDEX_PREFIX= "topic/";

    @Autowired
    TopicService topicService;
    @ResponseBody
    @RequestMapping(INDEX_PREFIX+"loadAllTopicForTable")
    public DataGirdView loadAllTopicForTable(TopicVo topicVo){

        return this.topicService.queryAllTopicForTable(topicVo);
    }
    @ResponseBody
    @RequestMapping(INDEX_PREFIX+"loadTopicByTopicid")
    public Topic loadTopicByTopicid(TopicVo topicVo){

        return this.topicService.queryTopicByTopicid(topicVo);
    }
    @ResponseBody
    @RequestMapping(INDEX_PREFIX+"addTopic")
    public DataGirdView addTopic(TopicVo topicVo){

        return this.topicService.insertTopic(topicVo);
    }
 @ResponseBody
    @RequestMapping(INDEX_PREFIX+"updateTopic")
    public DataGirdView updateTopic(TopicVo topicVo){

        return this.topicService.updateTopic(topicVo);
    }
    @ResponseBody
    @RequestMapping(INDEX_PREFIX+"deleteTopic")
    public DataGirdView deleteTopic(TopicVo topicVo){

        return this.topicService.deleteTopic(topicVo);
    }
    @ResponseBody
    @RequestMapping(INDEX_PREFIX+"addCilck")
    public DataGirdView addCilck(TopicVo topicVo){

        return this.topicService.addClickamount(topicVo);
    }

}

